﻿using Assets.Scripts.DL.Consts;
using Assets.Scripts.DL.Mgrs;
using UnityEngine;

public class PlayerWalk : PlayerBaseState {
	public PlayerWalk(PlayerController controller, PlayerStateEnum stateName, State<PlayerStateEnum> superFSM, StateFactory<PlayerStateEnum> factory) : base(controller, stateName, superFSM, factory) {
		AddConditionToSelf(() => controller.WalkInput);

		AddNewTransition(PlayerStateEnum.Run, () => !controller.WalkInput);
		AddNewTransition(PlayerStateEnum.Crouch, () => controller.DownInput);
	}

	public override void Enter() {
		_controller.PlayAnim(PlayerStateEnum.Walk);
		var mul = _controller.StateData.TimeSpeedMultiple;
		_controller.Velocity = new Vector2(mul * _controller.ConfigData.WalkSpeed * _controller.XInput, 0);
		_controller.ChangeDir();
		AudioManager.Play(_controller.StateAudio, AudioStr.PlayerRunAudio, true);
	}

	public override void Update() {
		base.Update();
	}
	public override void Exit() {
	}
}